package com.mobile.collect.beans;

import com.mobile.collect.db.DaoSession;
import com.mobile.collect.db.DeviceInfoDao;
import com.mobile.collect.db.DevicePicInfoDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;


@Entity
public class DeviceInfo {
    @Id
    private Long _ID;
    private String deviceName;
    private String deviceNo;
    private String deviceDes;
    private String deviceCompany;
    private String createUser;
    private String createTime;
    private String editTime;
    private boolean hadExport;
    private boolean isMerge;
    private long pointCount;


    @ToMany(referencedJoinProperty = "parentId")
    private List<DevicePicInfo> devicePicList;
    /**
     * Used to resolve relations
     */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /**
     * Used for active entity operations.
     */
    @Generated(hash = 1956318327)
    private transient DeviceInfoDao myDao;


    @Generated(hash = 2004534859)
    public DeviceInfo(Long _ID, String deviceName, String deviceNo, String deviceDes,
            String deviceCompany, String createUser, String createTime, String editTime,
            boolean hadExport, boolean isMerge, long pointCount) {
        this._ID = _ID;
        this.deviceName = deviceName;
        this.deviceNo = deviceNo;
        this.deviceDes = deviceDes;
        this.deviceCompany = deviceCompany;
        this.createUser = createUser;
        this.createTime = createTime;
        this.editTime = editTime;
        this.hadExport = hadExport;
        this.isMerge = isMerge;
        this.pointCount = pointCount;
    }

    @Generated(hash = 2125166935)
    public DeviceInfo() {
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getDeviceNo() {
        return deviceNo;
    }

    public void setDeviceNo(String deviceNo) {
        this.deviceNo = deviceNo;
    }

    public String getDeviceDes() {
        return deviceDes;
    }

    public void setDeviceDes(String deviceDes) {
        this.deviceDes = deviceDes;
    }

    public Long get_ID() {
        return this._ID;
    }

    public void set_ID(Long _ID) {
        this._ID = _ID;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 949642044)
    public List<DevicePicInfo> getDevicePicList() {
        if (devicePicList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            DevicePicInfoDao targetDao = daoSession.getDevicePicInfoDao();
            List<DevicePicInfo> devicePicListNew = targetDao
                    ._queryDeviceInfo_DevicePicList(_ID);
            synchronized (this) {
                if (devicePicList == null) {
                    devicePicList = devicePicListNew;
                }
            }
        }
        return devicePicList;
    }

    /**
     * Resets a to-many relationship, making the next get call to query for a fresh result.
     */
    @Generated(hash = 603438992)
    public synchronized void resetDevicePicList() {
        devicePicList = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    public String getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getEditTime() {
        return this.editTime;
    }

    public void setEditTime(String editTime) {
        this.editTime = editTime;
    }


    public String getDeviceCompany() {
        return deviceCompany;
    }

    public void setDeviceCompany(String deviceCompany) {
        this.deviceCompany = deviceCompany;
    }

    public boolean isHadExport() {
        return hadExport;
    }

    public void setHadExport(boolean hadExport) {
        this.hadExport = hadExport;
    }

    public boolean getHadExport() {
        return this.hadExport;
    }

    public String getCreateUser() {
        return this.createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public boolean isMerge() {
        return isMerge;
    }

    public void setMerge(boolean merge) {
        isMerge = merge;
    }

    public boolean getIsMerge() {
        return this.isMerge;
    }

    public void setIsMerge(boolean isMerge) {
        this.isMerge = isMerge;
    }

    @Override
    public String toString() {
        return "DeviceInfo{" +
                "_ID=" + _ID +
                ", deviceName='" + deviceName + '\'' +
                ", deviceNo='" + deviceNo + '\'' +
                ", deviceDes='" + deviceDes + '\'' +
                ", deviceCompany='" + deviceCompany + '\'' +
                ", createUser='" + createUser + '\'' +
                ", createTime='" + createTime + '\'' +
                ", editTime='" + editTime + '\'' +
                ", hadExport=" + hadExport +
                ", isMerge=" + isMerge +
                ", pointCount=" + pointCount +
                '}';
    }

    public long getPointCount() {
        return pointCount;
    }

    public void setPointCount(long pointCount) {
        this.pointCount = pointCount;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1233815869)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getDeviceInfoDao() : null;
    }
}
